package com.jsmile.cloud.msgcenter.zf.req.ali;

import com.alibaba.fastjson.annotation.JSONField;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author xiao
 * @since 2021/5/30
 */
@Data
public class AliAuthBizContent {
    @JSONField(name = "detail")
    private Detail detail;

    @JSONField(name = "error")
    private Error error;

    @JSONField(name = "notify_context")
    private NotifyContext notifyContext;

    @Data
    public static class Detail {
        @ApiModelProperty(value = "被授权应用appId")
        @JSONField(name = "app_id")
        private String appId;
        @ApiModelProperty(value = "授权应用appId")
        @JSONField(name = "auth_app_id")
        private String authAppId;
        @ApiModelProperty(value = "授权时间")
        @JSONField(name = "auth_time")
        private String authTime;
        @ApiModelProperty(value = "授权code")
        @JSONField(name = "app_auth_code")
        private String appAuthCode;
        @ApiModelProperty(value = "授权Token")
        @JSONField(name = "app_auth_token")
        private String appAuthToken;
        @ApiModelProperty(value = "授权用户userId")
        @JSONField(name = "user_id")
        private String userId;
    }

    @Data
    public static class Error {
        @ApiModelProperty(value = "若系统服务商（ISV）签约了特殊的产品，且该产品的授权前置条件不满足则会有该值。目前仅有签约了口碑的“在线购买/口碑商品”产品的系统服务商（ISV）可能会收到该错误码")
        @JSONField(name = "appstore_online_pay")
        private String appstoreOnlinePay;
    }

    @Data
    public static class NotifyContext {
        @ApiModelProperty(value = "授权触发者，比如服务市场的服务订购通知，trigger为appstore")
        @JSONField(name = "trigger")
        private String trigger;

        @ApiModelProperty(value = "授权触发者相关联的上下文，具体取值和trigger 有关,目前值为空")
        @JSONField(name = "trigger_context")
        private String triggerContext;
    }
}
